<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function countDow(time){
            var nowTime= +new Date();
            var inputTime= +new Date(time);
            var times=(inputTime-nowTime)/1000;
            var d=parseInt(times/60/60/24);
            d =d<10?'0'+d:d;
            var h=parseInt(times/60/60%24);
            h =h<10?'0'+h:h;
            var m=parseInt(times/60%60);
            m =m<10?'0'+m:m;
            var s=parseInt(times%60);
            s =s<10?'0'+s:s;
            return d+'天'+h+'时'+m+'分'+s+'秒';
        }
        console.log(countDow('2004-12-16 18:00:00'));//你输入的时间
        var date=new Date();//返回当前时间
        console.log(date);//输出你输入的时间距离现在还有多少时间
    </script>
</body>
</html>